package api

import (
	"commerce/api/handler"
	"commerce/global"
	"github.com/gin-gonic/gin"
	jwt "github.com/golangblogs/gojwt"
)

func Commerce(r *gin.Engine) {
	api := r.Group("./api")
	{
		user := api.Group("/user")
		{
			user.POST("/register", handler.Register)
			user.POST("/login", handler.Login)
		}
		chat := api.Group("/chat")
		{
			chat.Use(jwt.JWTAuth(global.JWT_KEY))
			chat.GET("/ws", handler.Chat)
			chat.POST("/find", handler.FindChatHistory)
		}
	}
}
